package com.cloud.custom.api.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cloud.custom.api.bean.SysInfo;
import com.cloud.custom.api.service.CustomBizInterfaceService;

@Service
@Transactional
public class CustomBizInterfaceServiceImpl implements CustomBizInterfaceService {

	@Autowired
	private JdbcTemplate jdbcTemplate;

	@Override
	public List<SysInfo> loadSystem(String parts) {
		List<SysInfo> info = jdbcTemplate
				.query("select distinct 0 as sysId, t.biz_icon as iconImage, t.biz_name as sysName, 0 as frameType, CONCAT('/custom/biz/', t.biz_id, '/tasklistgroup/', t2.group_id) as sysPath from custom_biz_config t, task_list t1, task_list_group t2 where t.biz_id = t2.biz_id and t1.group_id = t2.group_id and t.enable_flag = 1 and exists (select * from task_list_part t3 where t1.task_list_id = t3.task_list_id and t3.part_id in("
						+ parts + "))", new BeanPropertyRowMapper<SysInfo>(SysInfo.class));
		return info;
	}

}
